/**
 * 
 */
package com.boot.springBoot.interview;

/**
 * @author Administrator
 *
 */
public class ThreadInterview implements Runnable{

	
	private static Integer x = new Integer(0);
	
	@Override
	public void run() {
		
		while(true){			
			synchronized (x){
				if(x < 100){
					System.out.println("x = "+x);
					x++;
					System.out.println(" x = " +x + " 线程名字"+Thread.currentThread().getName());
				}else{
					break;
				}
			}
		}				
	}
	
	
	public static void main(String[] args) {
		Thread t1 = new Thread(new ThreadInterview());
		Thread t2 = new Thread(new ThreadInterview());
		t1.start();
		t2.start();
		
	}

}
